<template>
  <div>
    <a-card :bordered="false">
      <f-search-form :more="false" @searchHandler="searchHandler">
        <f-search-form-item label="专业包代码" name="majorCode"/>
        <f-search-form-item label="专业包名称" name="majorName"/>
        <f-search-form-item label="工程包代码" name="packageNo"/>
        <f-search-form-item label="工程包名称" name="packageName"/>
<!--        <f-search-form-item label="物料WBS&#45;&#45;无此字段" name="packageNo"/>-->
<!--        <f-search-form-item label="物料代码&#45;&#45;无此字段" name="packageNo"/>-->
        <f-search-form-item label="服务WBS" name="serviceWbsCode"/>
        <f-search-form-item label="服务代码" name="serviceCode"/>
        <f-search-form-item label="项目（名称）" name="materiaSpecs"/>
<!--        <f-search-form-item label="设备材料名称&#45;&#45;无此字段" name="packageNo"/>-->
        <f-search-form-item label="层级号" name="层级号"/>
        <f-search-form-item label="科目名称" name="subjectName"/>
<!--        <f-search-form-item label="项目&#45;&#45;无此字段" name="packageNo"/>-->
        <f-search-form-item label="区域" name="materialArea"/>
        <f-search-form-item label="系统" name="materialUse"/>
        <f-search-form-item label="历史版本" name="packageNo"/>
        <f-search-form-item label="履历筛选" name="packageNo"/>
      </f-search-form>
      <f-table ref="table" rowKey="materialPackage100Id" :scroll="{x:3410}" :columns="columns" :exportBtn="false" :multiple="false" :operator="operator" :params="queryParam" :api="api.bmp">
        <span slot="action" slot-scope="text, record">
          <template>
            <a @click="$refs.drawer.showDrawer(record)">编辑</a>
            <a-divider type="vertical"/>
          </template>
          <a-dropdown>
            <a class="ant-dropdown-link">更多 <a-icon type="down"/></a>
            <a-menu slot="overlay">
              <a-menu-item v-if="$auth('table.delete')">
                <a href="javascript:;" @click="$refs.table.del(record)">删除</a>
              </a-menu-item>
            </a-menu>
          </a-dropdown>
        </span>
      </f-table>
      <bmp-drawer ref="drawer"></bmp-drawer>
    </a-card>
  </div>
</template>
<script>
  import bmpDrawer from './bmp_drawer.vue'
  import api from './js/api'
  export default {
    name: 'TableList',
    components: {
      bmpDrawer
    },
    data() {
      let me = this
      //操作按钮
      let operator = []
      operator.push({
        name: '提交',
        icon: '',
        that: this,
        handler: function(table, that) {
            that.$refs.drawer.showDrawer()
        }
      })
      operator.push({
        name: '修正变更',
        icon: '',
        that: this,
        handler: function(table, that) {
          that.$refs.drawer.showDrawer()
        }
      })
      operator.push({
        name: '追加变更',
        icon: '',
        that: this,
        handler: function(table, that) {
          that.$refs.drawer.showDrawer()
        }
      })
      operator.push({
        name: '下载模板',
        icon: '',
        that: this,
        handler: function(table, that) {
          that.$refs.drawer.showDrawer()
        }
      })
      operator.push({
        name: '导入数据',
        icon: '',
        that: this,
        handler: function(table, that) {
          that.$refs.drawer.showDrawer()
        }
      })
      operator.push({
        name: '转存200',
        icon: '',
        that: this,
        handler: function(table, that) {
          that.$refs.drawer.showDrawer()
        }
      })
      operator.push({
        name: '分承包合同下达',
        icon: '',
        that: this,
        handler: function(table, that) {
          that.$refs.drawer.showDrawer()
        }
      })
      return {
        api:  Object.assign(api, this.api),
        //列表初始化查询参数
        queryParam: {},
        // 表头
        columns: [
          {
            title: '序号',
            fixed: 'left',
            width: '10',
            align: 'center',
            customRender: (text, record, index) => index + 1
          },
          {
            title: '项目代码',
            fixed: 'left',
            width: '100',
            align: 'center',
            dataIndex: 'projectCode'
          },
          {
            title: '项目名称',
            fixed: 'left',
            width: '100',
            align: 'center',
            dataIndex: 'projectName'
          },
          {
            title: '工程包名称',
            fixed: 'left',
            width: '100',
            align: 'center',
            dataIndex: 'packageName'
          },
          {
            title: '工程包代码',
            fixed: 'left',
            width: '100',
            align: 'center',
            dataIndex: 'packageNo'
          },
          {
            title: '专业代码',
            fixed: 'left',
            width: '100',
            align: 'center',
            dataIndex: 'majorCode'
          },
          {
            title: '服务代码',
            fixed: 'left',
            width: '100',
            align: 'center',
            dataIndex: 'serviceCode'
          },
          {
            title: '服务WBS代码',
            fixed: 'left',
            width: '100',
            align: 'center',
            dataIndex: 'serviceWbsCode'
          },
          {
            title: '项目（名称）',
            width: 150,
            align: 'center',
            dataIndex: 'materiaSpecs'
          },
          {
            title: '科目名称',
            fixed: 'left',
            width: '100',
            align: 'center',
            dataIndex: 'subjectName'
          },
          {
            title: '层级号',
            width: '100',
            align: 'center',
            dataIndex: 'levelNo'
          },
          {
            title: '分承包发包项目描述',
            width: '100',
            align: 'center',
            dataIndex: 'packageDesc'
          },
          {
            title: '对外合同描述',
            width: '100',
            align: 'center',
            dataIndex: 'contractDesc'
          },
          {
            title: '区域',
            width: '100',
            align: 'center',
            dataIndex: 'materialArea'
          },
          {
            title: '系统',
            width: '100',
            align: 'center',
            dataIndex: 'materialUse'
          },
          {
            title: '100预算成本工程量',
            width: '100',
            align: 'center',
            dataIndex: 'costQuantity100'
          },
          {
            title: '200预算成本工程量',
            width: '100',
            align: 'center',
            dataIndex: 'costQuantity200'
          },
          {
            title: '有合同安装单价',
            width: '100',
            align: 'center',
            dataIndex: 'contractInstallPrice1'
          },
          {
            title: '拟合同安装单价',
            width: '100',
            align: 'center',
            dataIndex: 'contractInstallPrice2'
          },
          {
            title: '合同安装单价',
            width: '100',
            align: 'center',
            dataIndex: 'contractInstallPrice3'
          },
          {
            title: '有合同其他单价',
            width: '100',
            align: 'center',
            dataIndex: 'contractOtherPrice1'
          },
          {
            title: '拟合同其他单价',
            width: '100',
            align: 'center',
            dataIndex: 'contractOtherPrice2'
          },
          {
            title: '合同其他单价',
            width: '100',
            align: 'center',
            dataIndex: 'contractOtherPrice3'
          },
          {
            title: '包商1合同量',
            width: '100',
            align: 'center',
            dataIndex: 'supplierNum1'
          },
          {
            title: '包商2合同量',
            width: '100',
            align: 'center',
            dataIndex: 'supplierNum2'
          },
          {
            title: '包商3合同量',
            width: '100',
            align: 'center',
            dataIndex: 'supplierNum3'
          },
          {
            title: '包商4合同量',
            width: '100',
            align: 'center',
            dataIndex: 'supplierNum4'
          },
          {
            title: '包商5合同量',
            width: '100',
            align: 'center',
            dataIndex: 'supplierNum5'
          },
          {
            title: '包商6合同量',
            width: '100',
            align: 'center',
            dataIndex: 'supplierNum6'
          },
          {
            title: '包商7合同量',
            width: '100',
            align: 'center',
            dataIndex: 'supplierNum7'
          },
          {
            title: '包商8合同量',
            width: '100',
            align: 'center',
            dataIndex: 'supplierNum8'
          },
          {
            title: '包商9合同量',
            width: '100',
            align: 'center',
            dataIndex: 'supplierNum9'
          },
          {
            title: '包商10合同量',
            width: '100',
            align: 'center',
            dataIndex: 'supplierNum10'
          },
          {
            title: '添加时间',
            width: '100',
            align: 'center',
            dataIndex: 'createTime'
          },
          {
            title: '更新时间',
            width: '100',
            align: 'center',
            dataIndex: 'updateTime'
          },
          {
            title: '操作',
            width: '100',
            align: 'center',
            scopedSlots: { customRender: 'action' }
          }
        ],
        operator: operator
      }
    },
    created() {
    },
    methods: {
    }
  }
</script>
